# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-tabulate
_pkgname=tabulate
pkgver=0.8.5
pkgrel=1
pkgdesc='Pretty-print tabular data in Python, a library and a command-line utility.'
arch=('any')
url='https://bitbucket.org/astanin/python-tabulate'
license=('MIT')
depends=('python2' 'python2-setuptools')
makedepends=('python2-setuptools')
checkdepends=('python2-nose' 'python2-numpy' 'python2-pandas' 'python2-wcwidth')
optdepends=('python2-numpy: NumPy array support'
            'python2-pandas: pandas.DataFrame support'
            'python2-wcwidth: wide-character support')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('137f576ac5adc29ad82f77da499804b110ddc7f12c5f85cdc79bdd5dfd37404d49f1c5667e6f8721e48f949b684c71b330b8e4fae4ef8a933af24d68fd0665c5')

build() {
  cd "$_pkgname-$pkgver"

  python2 setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --skip-build -O1

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  mv "$pkgdir/usr/bin/tabulate" "$pkgdir/usr/bin/tabulate2"
}

